package com.example.demo.internettongxin.qunliao;

import java.io.DataOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Description T3client
 * @Author songchuanlong
 * @Date 2025-05-30
 */
public class T3client {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 9999);
        new T3receive(socket).start();
        OutputStream outputStream = socket.getOutputStream();
        DataOutputStream dos = new DataOutputStream(outputStream);
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入聊天内容：");
            String msg = sc.nextLine();
            if("exit".equals(msg)){
                socket.close();
                dos.close();
                break;
            }
            dos.writeUTF(msg);
            dos.flush();
        }

    }
}
